/*
 * Copyright 2012 Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.google.dspl.validate.validator;

import com.google.dspl.model.DatasetItem;
import com.google.dspl.validate.ValidationContext;
import com.google.dspl.validate.violation.Violation;

import java.util.List;

/**
 * Interface for a validator that validates one type of item in a dataset.
 *
 * @author Shardul Deo
 */
public interface Validator<T extends DatasetItem<T>> {

  /**
   * Validate the given item in the given context.
   *
   * @param item Item to be validated.
   * @param context The context that contains information about the dataset the item belongs to and
   *        also, if needed, information about other datasets it might refer to.
   * @return list of {@link Violation}s
   */
  List<Violation> validate(T item, ValidationContext context);
}
